1. Field of the Invention
The invention relates to digital data processing systems and more particularly to relational data base systems.
2. Description of Related Art Data base systems facilitate storage of and access to large numbers of data items. Generally, the data items are stored in fields in records and the data base is structured as a group of related sets of records. Often, a value in one set will be dependent on another set. For example, a single record in one of the sets will contain information about some or all of the records in another of the sets. When this is the case, the field is dependent on the state of the other set, and a change in that state should result in a change in the value of the field. Similarly, all of the records in a set may include a value obtained from a single record in another set; again, if the value in the single record changes, the values in the records in the other set should change.
In the prior art, such dependencies were generally dealt with by the programs which used the data base. The programmer who was working with a given set of records knew for example that there was a field in a record in another set whose value depended on the given set of records, and consequently, whenever he wrote a program which changed the given set, he made sure that the program also changed the record in the other set. There are several difficulties with this approach: first, the programmer and his successors must know that there is a field in one set dependent on another set; if that dependence is not documented, the program will not perform the update of the total number. Second, even if he does know of the dependence, he may forget to provide for it in a program, and the error will insure that the total number will occasionally fail to be updated. Third, even if the programmer never fails to include the update, the code will be repeated over and oven again and will be scattered throughout many programs, a situation which both wastes storage space and makes debugging or changing the update code extremely difficult.
The prior art has realized that dependencies between a value and a set were more properly dealt with in the definition of the data base than in the programs which used the data base, but has generally dealt with the problem in one of two fashions: it has either computed the value of the dependent field only once, namely at the time the record containing the field was created, or it has treated the dependent field as a virtual field and has recomputed its value each time the field is referenced. Both options are illustrated by the definitions in the CODASYL data definition language for SOURCE items and RESULT items, explained in T. William Olle, The Codasyl Approach to Data Base Management, John Wiley & Sons, New York, 1978, pp. 96-97, 106-107. The SOURCE item is a copy of an item in another set. When the ACTUAL option is specified, the copy is made when the record containing the SOURCE item is created; when the VIRTUAL option is specified, no actual copy is made and the value is fetched from the other set whenever the SOURCE item is read. Similarly, the RESULT item is defined as the result of the execution of a procedure on a set of records; when ACTUAL is specified, the copy is made when the record containing the RESULT item is created; when the VIRTUAL option is specified, the value is computed whenever the RESULT item is read.
Other data base systems have also used virtual fields where a result was computed or data required from another set of records. For example, in relational data bases, the data is presented to the user as two-dimensional tables. There are two kinds of tables: base tables, which actually contain the data items, and view tables, which are virtual tables made of fields from the base tables. View table field values may be the result of computation, or they may be from other tables, and thus may correspond to the CODASYL VIRTUAL SOURCE and RESULT fields.
While the virtual field approach assures that the data in a field is current, it has the great disadvantage of requiring the recomputation of a value each time the value is read. For example, if such a virtual field specifies the total monetary value of all the parts in a large set of parts records, the recomputation may involve fetching every part record.
A system which addresses the recomputation problem is described in Bernstein, Blaustein, and Clarke, "Fast Maintenance of Semantic Integrity Assertions Using Redundant Aggregate Data", Bernstein, et al. propose that consistency testing be done using aggregate data specifying information such as the current upper and lower bounds in the set. The aggregate data is updated each time a change is made in the set which affects the value of the aggregate data. While the system of Bernstein, et al. is useful for consistency checking, it does not address the more general problem of user-defined fields which are dependent from records in other sets of records. Another reference, Michael Hammer and Dennis McLeod, "Data Base Description with SDM, a Semantic Data Base Model", ACM Transactions on Data Base Systems, vol. 6, No. 3, September, 1981, pp. 351-386, gives an overview of a non-relational data base system which permits sets of information to be defined which contain values derived from other sets of information and indicates that copies of the derived values may be maintained in the data base. The reference does not, however, describe how these values are defined or maintained.